From 3612eabd5495f36b482a779c0bb363719b4f71d8 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 21 Jul 2014 19:07:08 -0700 Subject: [PATCH 1/2] Added alert when attemping to create account that already exists. --- client/app/signup/signup.html | 1 + client/app/signup/signup.js | 4 ++++ client/built.min.js | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/app/signup/signup.html b/client/app/signup/signup.html index 8ce55b2..ca9db03 100644 --- a/client/app/signup/signup.html +++ b/client/app/signup/signup.html @@ -15,6 +15,7 @@

Sign Up!

+
Account already exists.
diff --git a/client/app/signup/signup.js b/client/app/signup/signup.js index 3d43dfc..ba392ee 100644 --- a/client/app/signup/signup.js +++ b/client/app/signup/signup.js @@ -2,6 +2,8 @@ angular.module('ramblApp.signup', []) .controller('signupController', ['$scope', '$window', '$location', 'Auth', 'EasyRTC', function ($scope, $window, $location, Auth, EasyRTC) { + + $scope.accountAlreadyExists = false; // if user has userName and token, redirect to lobby, else check if they're coming from // lobby/room having signed out and if so remove them from room and/or disconnect from easyrtc @@ -21,6 +23,8 @@ angular.module('ramblApp.signup', []) .then(function (userObject) { if (userObject.token !== undefined && userObject.userName !== undefined) { Auth.processLogin(userObject); + } else { + $scope.accountAlreadyExists = true; } }) .catch(function (error) { diff --git a/client/built.min.js b/client/built.min.js index 1ae9733..6b502ae 100755 --- a/client/built.min.js +++ b/client/built.min.js @@ -13,7 +13,7 @@ angular.module("ramblApp.authServices",[]).factory("Auth",["$http","$location"," angular.module("ramblApp.easyRTCServices",[]).factory("EasyRTC",["$window","$timeout","$location",function(e,t,n){var o=null,c=!1,r=function(){return c},a=function(e){o=e},s=function(){return o},i=function(e){easyrtc.call(e,function(e){console.log("completed call to "+e)},function(e,t){console.log("err:"+t)},function(e,t){console.log((e?"accepted":"rejected")+" by "+t)})},l=function(n,o){for(var c=e.document.getElementById("partner_name_container");c.hasChildNodes();)c.removeChild(c.lastChild);for(var r in o){"is connected"!==e.easyrtc.getConnectStatus(r)&&t(function(){"not connected"===e.easyrtc.getConnectStatus(r)&&i(r)},3e3);var a=e.document.createElement("p"),s=e.document.createTextNode("Interview Partner: "+o[r].username);a.appendChild(s),c.appendChild(a)}},u=function(t,n){for(var o=e.document.getElementById("partner_name_container");o.hasChildNodes();)o.removeChild(o.lastChild);for(var c in n){var r=e.document.createElement("p"),a=e.document.createTextNode("Interview Partner: "+n[c].username);r.appendChild(a),o.appendChild(r)}},m=function(){var t=function(){var t=e.document.getElementById("self");e.easyrtc.setVideoObjectSrc(t,e.easyrtc.getLocalStream()),e.easyrtc.setRoomOccupantListener(l)},c=function(e){console.log(e)};o?e.easyrtc.getRoomList(function(r){void 0===r[o]||r[o].numberClients<=1?(e.easyrtc.setRoomOccupantListener(u),e.easyrtc.joinRoom(o),e.easyrtc.initMediaSource(t,c),e.easyrtc.setStreamAcceptor(function(t,n){var o=e.document.getElementById("other");e.easyrtc.setVideoObjectSrc(o,n)}),e.easyrtc.setOnStreamClosed(function(){e.document.getElementById("other")&&e.easyrtc.setVideoObjectSrc(e.document.getElementById("other"),"")})):n.path("/lobby")}):n.path("/lobby")},d=function(t){var n=function(){c=!0,t()},o=function(e){console.log(e)};c===!1&&(e.easyrtc.setUsername(e.localStorage.getItem("ramblUsername")),e.easyrtc.connect("interview",n,o))},y=function(){e.easyrtc.setRoomOccupantListener(null),e.easyrtc.hangupAll(),e.easyrtc.leaveRoom(o),e.easyrtc.getLocalStream()&&e.easyrtc.getLocalStream().stop(),o=null},f=function(){e.easyrtc.getLocalStream()&&e.easyrtc.getLocalStream().stop(),c=!1,e.easyrtc.disconnect()},g=function(t){var n=[];e.easyrtc.getRoomList(function(e){for(var o in e)1===e[o].numberClients&&n.push(e[o].roomName);t(n)},function(){console.log("error getting rooms")})};return{interviewInit:m,disconnect:f,connect:d,getRooms:g,leaveRoom:y,setCurrentRoom:a,getCurrentRoom:s,getConnectionStatus:r}}]); angular.module("ramblApp.interviewServices",[]).factory("InterviewQuestions",[function(){var o=["Are you the best person for this job? Why?","Are you overqualified for this job?","Describe a difficult experience at work and how you handled it.","Describe yourself.","Describe your best boss and your worst boss.","Describe your career goals.","Describe your work style.","Do you prefer to work alone or on a team?","Do you take work home with you?","Give some examples of teamwork.","Have you ever had difficulty working with a manager?","Have you gotten angry at work? What happened?","How do you handle pressure?","How do you measure success?","How long do you expect to work for this company?","How much do you expect to get paid?","How would you describe the pace at which you work?","How would you describe yourself?","How would you handle it if your boss was wrong?","Is there a type of work environment you prefer?","Is there anything else I can tell you about the job and the company?","Tell me why you want to work here.","What are you looking for in your next position?","What are you passionate about?","What are your goals for the future?","What are your salary requirements?","What can you do for this company?","What can you contribute to this company?","What challenges are you looking for in your next job?","What did you like or dislike about your previous job?","What do you expect from a supervisor?","What do you find are the most difficult decisions to make?","What have you learned from your mistakes?","What interests you about this job?","What is your greatest strength?","What is your greatest weakness?","What major challenges have you handled?","What problems have you encountered at work?","What was your biggest accomplishment (failure) in this position?","What was most (least) rewarding about your job?","What relevant experience do you have?","What will you do if you don't get a job offer?","Why are you leaving your job?","Why do you want this job?","Why did you resign?","Why did you quit your job?","Why were you fired?","Why should we hire you?","What do you know about this company?"];return{questions:o}}]); angular.module("ramblApp.home",[]).controller("homeController",["$scope","$window","$location","Auth","EasyRTC",function(o,n,e,t,l){n.localStorage.getItem("ramblUsername")&&n.localStorage.getItem("ramblToken")?e.path("/lobby"):(null!==l.getCurrentRoom()&&l.leaveRoom(),l.getConnectionStatus()===!0&&l.disconnect()),o.login=function(){t.login(o.user).then(function(o){t.processLogin(o)}).catch(function(o){console.error(o)})},o.signout=t.signout}]); -angular.module("ramblApp.signup",[]).controller("signupController",["$scope","$window","$location","Auth","EasyRTC",function(o,n,e,t,l){n.localStorage.getItem("ramblUsername")&&n.localStorage.getItem("ramblToken")?e.path("/lobby"):(null!==l.getCurrentRoom()&&l.leaveRoom(),l.getConnectionStatus()===!0&&l.disconnect()),o.signup=function(){t.signup(o.user).then(function(o){void 0!==o.token&&void 0!==o.userName&&t.processLogin(o)}).catch(function(o){console.error(o)})},o.signout=t.signout}]); +angular.module("ramblApp.signup",[]).controller("signupController",["$scope","$window","$location","Auth","EasyRTC",function(o,n,t,e,a){o.accountAlreadyExists=!1,n.localStorage.getItem("ramblUsername")&&n.localStorage.getItem("ramblToken")?t.path("/lobby"):(null!==a.getCurrentRoom()&&a.leaveRoom(),a.getConnectionStatus()===!0&&a.disconnect()),o.signup=function(){e.signup(o.user).then(function(n){void 0!==n.token&&void 0!==n.userName?e.processLogin(n):o.accountAlreadyExists=!0}).catch(function(o){console.error(o)})},o.signout=e.signout}]); angular.module("ramblApp.about",[]).controller("aboutController",["$scope","$window","EasyRTC",function(o,n,t){null!==t.getCurrentRoom()&&t.leaveRoom(),t.getConnectionStatus()===!0&&t.disconnect()}]); angular.module("ramblApp.lobby",[]).controller("lobbyController",["$scope","$window","$location","$interval","EasyRTC","Auth",function(o,t,n,a,e,r){o.data={},o.data.userName=t.localStorage.getItem("ramblUsername"),o.setCurrentRoomAndNavigate=function(o){e.setCurrentRoom(o),n.path("/room")},o.signout=r.signout,e.getCurrentRoom()&&e.leaveRoom(),e.connect(function(){e.getRooms(function(t){o.$apply(function(){o.data.rooms=t})})}),e.getRooms(function(t){o.$apply(function(){o.data.rooms=t})});var u=a(function(){e.getConnectionStatus()===!0&&null===e.getCurrentRoom()?e.getRooms(function(t){o.$apply(function(){o.data.rooms=t})}):a.cancel(u)},2e3)}]); angular.module("ramblApp.room",[]).controller("roomController",["$scope","$window","$location","EasyRTC","InterviewQuestions","Auth",function(o,e,t,a,n,s){o.data={},o.data.currentRoom=a.getCurrentRoom(),o.data.userName=e.localStorage.getItem("ramblUsername"),o.data.questions=n.questions,o.shuffleQuestions=function(){o.data.questions=e._.shuffle(o.data.questions)},o.signout=s.signout,o.showQuestions=!1,o.leaveRoom=a.leaveRoom,a.interviewInit()}]); \ No newline at end of file From d6acecb7dd0c0075d79d56ce7d4316d5514e61b5 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 21 Jul 2014 19:16:32 -0700 Subject: [PATCH 2/2] Added alert on invalid username/password. --- client/app/home/home.html | 1 + client/app/home/home.js | 8 +++++++- client/app/signup/signup.html | 2 +- client/built.min.js | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/app/home/home.html b/client/app/home/home.html index 99da332..2cd237d 100644 --- a/client/app/home/home.html +++ b/client/app/home/home.html @@ -17,6 +17,7 @@

Rambl