Skip to content

Commit

Permalink
fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelneu committed Mar 14, 2019
1 parent b341f1c commit 45135b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/client/views/login/login.html
Expand Up @@ -20,19 +20,22 @@
<div class="field">
<label> Email</label>
<input type="email"
ng-disabled="isBusy"
id='email'
placeholder="foo@bar.edu"
ng-model="email">
</div>
<div class="field">
<label> Password</label>
<input type="password"
ng-disabled="isBusy"
id='password'
placeholder="Password (at least 6 characters)"
ng-model="password" required>
</div>
<div class="field">
<button id="login-password"
ng-disabled="isBusy"
type="submit"
class="fluid ui login button">
Login
Expand All @@ -47,6 +50,7 @@
<button id="register"
type="submit"
class="fluid ui register button"
ng-disabled="isBusy"
ng-click="register()">
Register
</button>
Expand All @@ -60,12 +64,14 @@
<div class="field">
<label> Email</label>
<input type="email"
ng-disabled="isBusy"
id='email'
placeholder="foo@bar.edu"
ng-model="email">
</div>
<div class="field">
<button id="forgot-password"
ng-disabled="isBusy"
type="submit"
class="fluid ui login button">
Send Reset Email
Expand Down
13 changes: 13 additions & 0 deletions app/client/views/login/loginCtrl.js
Expand Up @@ -7,6 +7,7 @@ angular.module('reg')
'Utils',
'AuthService',
function($scope, $http, $state, settings, Utils, AuthService){
$scope.isBusy = false;

// Is registration open?
var Settings = settings.data;
Expand All @@ -15,12 +16,22 @@ angular.module('reg')
// Start state for login
$scope.loginState = 'login';

function startWork() {
$scope.isBusy = true;
}

function finishWork() {
$scope.isBusy = false;
}

function onSuccess() {
$state.go('app.dashboard');
finishWork();
}

function onError(data){
$scope.error = data.message;
finishWork();
}

function resetError(){
Expand Down Expand Up @@ -52,6 +63,7 @@ angular.module('reg')
return;
}

startWork();
resetError();
AuthService.loginWithPassword(
$scope.email, $scope.password, onSuccess, onError);
Expand All @@ -62,6 +74,7 @@ angular.module('reg')
return;
}

startWork();
resetError();
AuthService.register(
$scope.email, $scope.password, onSuccess, onError);
Expand Down

0 comments on commit 45135b8

Please sign in to comment.