Skip to content

Commit

Permalink
Added Alexa login page. Fixed a few textual errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
barankyle committed Oct 25, 2017
1 parent 2434257 commit 8e19e19
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ var handlers = {
.catch(function(err) {
console.log(err);

return Promise.resolve('There was a problem executing your request; please try again. If this persists, please try again later, or let us know at [email protected].');
return Promise.resolve('There was a problem executing your request; please try again. Make sure you have linked the Alexa skill with your Google account. If your problems persist, please try again later, or let us know at [email protected].');
})
.then(function(message) {
self.emit(':tellWithCard', message, global.env.name, message);
Expand All @@ -224,7 +224,7 @@ var handlers = {
let message = '';

message += 'Welcome to ' + global.env.name + '. ';
message += 'You can ask this skill to get information about the status of your software stack.';
message += 'You can ask this skill to get information about the status of your software stack, as configured at opsbuddy.bitscoop.com.';

let reprompt = 'For instructions on what you can say, please say help me.';

Expand All @@ -240,7 +240,7 @@ var handlers = {

message += 'Here are some things you can say: ';
message += 'How is the stack doing?';
message += 'Tell me how the stack is doing.';
message += 'Tell me how the stack is doing. ';

message += 'You can also say stop if you\'re done. ';
message += 'So how can I help?';
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ exports.handler = function(event, context, callback) {
views.connections.delete(event, context, callback);
}
}
else if (path === '/alexa-login') {
views.alexaLogin(event, context, callback);
}
else if (path === '/login') {
views.login(event, context, callback);
}
Expand Down
36 changes: 36 additions & 0 deletions src/templates/alexa-login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8"/>

<title>Alexa Ops Buddy &middot; powered by BitScoop</title>

<meta name="description" content="Ops Buddy Demo" />

<!-- RequireJS configuration -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>

<script type="text/javascript" src="https://s3.amazonaws.com/alexa-2-demo/static/js/site.min.js" ></script>

<!-- External fonts -->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Quicksand:400|Roboto:300,400,700|Open+Sans:200,300,400,700|Source+Sans+Pro:300,400,700" />
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" />

<link rel="stylesheet" type="text/css" href="https://s3.amazonaws.com/opsbuddy/css/site.min.css" />
</head>

<body>
<div class="header flexbox flex-column flex-x-center">
<h1>BitScoop Ops Buddy</h1>

<div class="instructions">
To use this skill, you must sign in with the same Google account you used to create your account at opsbuddy.bitscoop.com.
</div>

<div class="logins flexbox flex-column flex-x-center">
<a href="https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&scope={{ scope }}&client_id={{ client_id }}&response_type={{ response_type }}&state={{ state }}&redirect_uri={{ redirect_uri }}"><button><i class="fa fa-google"></i> <span>Sign In with Google</span></button></a>
</div>
</div>
</body>
</html>
28 changes: 28 additions & 0 deletions src/views/alexa-login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

const assert = require('assert');

const Sequelize = require('sequelize');
const _ = require('lodash');
const cookie = require('cookie');
const nunjucks = require('nunjucks');


let renderer = nunjucks.configure('templates');

module.exports = function(event, context, callback) {
let html = renderer.render('alexa-login.html', event.queryStringParameters);

var response = {
statusCode: 200,
headers: {
'Content-Type': 'text/html',
'Access-Control-Allow-Origin': '*'
},
body: html
};

callback(null, response);

return Promise.resolve();
};
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions src/views/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@


module.exports = {
completeLogin: require('./complete_login'),
completeService: require('./complete_service'),
alexaLogin: require('./alexa-login'),
completeLogin: require('./complete-login'),
completeService: require('./complete-service'),
connections: require('./connections'),
home: require('./home'),
login: require('./login'),
Expand Down
2 changes: 1 addition & 1 deletion tutorial/step-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Select the ‘/’ resource, then click the Actions dropdown and select ‘Creat
Enter ‘complete-login’ for the Resource Name, and the Resource Path should be filled in with this automatically as well, which is what we want.
Leave the checkboxes unchecked and click the Create Resource button.
When that’s been created, click on the ‘/complete-login’ resource and follow the steps above for adding a GET method to that resource.
Repeat this process for the resources 'complete-service', 'connections', 'login', 'logout', 'signup', and 'users'.
Repeat this process for the resources 'alexa-login', 'complete-service', 'connections', 'login', 'logout', 'signup', and 'users'.
'/connections' needs a 'DELETE' method in additional to its 'GET', and '/users' does not need a 'GET' method but does need a 'DELETE' and 'PATCH' methods.
All of the others just need a 'GET'.

Expand Down

0 comments on commit 8e19e19

Please sign in to comment.