Skip to content

Commit

Permalink
feat: Login upon creation of user. bitraf#40
Browse files Browse the repository at this point in the history
  • Loading branch information
clehre committed Jun 30, 2024
1 parent 4da6724 commit 8cd4435
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
5 changes: 4 additions & 1 deletion web/src/p2k16/web/core_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ def register_account():
request.json["password"],
request.json.get("phone", None))
db.session.commit()
logger.info("new account: {}/{}".format(u.username, u.id))
service_authz_login()
logger.info(f"new account: {u.username}/{u.id}")
logger.info(f"You can now become a paying member and get door access!")

return jsonify({})


Expand Down
3 changes: 2 additions & 1 deletion web/src/p2k16/web/static/p2k16/p2k16.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@
self.registerAccount = () => {
CoreDataService.register_account(self.signupForm).then(() => {
self.signupForm = {};
P2k16.addInfos("Account created, please log in.");
$window.location.href = "/";
P2k16.addInfos("Account created, please log in with your username and password");
});
};

Expand Down
38 changes: 17 additions & 21 deletions web/src/p2k16/web/static/unauthenticated.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ <h3 class="text-center">Welcome to Bitraf</h3>

<div class="row text-center">
<div>
<button class="btn btn-sm" ng-click="ctrl.toggleSignupForm()" ng-class="!ctrl.showSignUpForm ? 'underline-button' : 'btn-secondary'">Already a member</button>
<button class="btn btn-sm" ng-click="ctrl.toggleSignupForm()" ng-class="ctrl.showSignUpForm ? 'underline-button' : 'btn-secondary'">Become a member</button>
<button class="btn btn-sm" ng-click="ctrl.toggleSignupForm()"
ng-class="!ctrl.showSignUpForm ? 'underline-button' : 'btn-secondary'">Already a member</button>
<button class="btn btn-sm" ng-click="ctrl.toggleSignupForm()"
ng-class="ctrl.showSignUpForm ? 'underline-button' : 'btn-secondary'">Become a member</button>
</div>
</div>

Expand All @@ -27,16 +29,14 @@ <h3 class="text-center">Welcome to Bitraf</h3>
<!-- <label for="login-username" class="col-sm-2 col-sm-offset-3">Username</label> -->
<div class="col-sm-6 col-sm-offset-3">
<input class="form-control" type="text" name="email" id="login-username" placeholder="Username"
autocomplete="username" autocapitalize="off"
ng-model="ctrl.loginForm.username"/>
autocomplete="username" autocapitalize="off" ng-model="ctrl.loginForm.username" />
</div>
</div>
<div class="form-group">
<!-- <label for="login-password" class="col-sm-2">Password</label> -->
<div class="col-sm-6 col-sm-offset-3">
<input class="form-control" type="password" name="password" id="login-password" placeholder="Password"
autocomplete="current-password"
ng-model="ctrl.loginForm.password"/>
autocomplete="current-password" ng-model="ctrl.loginForm.password" />
</div>
</div>
<div class="form-group text-center">
Expand All @@ -59,25 +59,22 @@ <h3 class="text-center">Welcome to Bitraf</h3>
<div class="form-group">
<!-- <label for="name" class="col-sm-2">Full Name</label> -->
<div class="col-sm-6 col-sm-offset-3">
<input class="form-control" type="text" name="name" id="name" placeholder="Full name"
autocomplete="name"
ng-model="ctrl.signupForm.name"/>
<input class="form-control" type="text" name="name" id="name" placeholder="Full name" autocomplete="name"
ng-model="ctrl.signupForm.name" />
</div>
</div>
<div class="form-group">
<!-- <label for="email" class="col-sm-2">Email</label> -->
<div class="col-sm-6 col-sm-offset-3">
<input class="form-control" type="text" name="email" id="email" placeholder="Email"
autocomplete="email"
ng-model="ctrl.signupForm.email"/>
<input class="form-control" type="text" name="email" id="email" placeholder="Email" autocomplete="email"
ng-model="ctrl.signupForm.email" />
</div>
</div>
<div class="form-group">
<!-- <label for="username" class="col-sm-2">Username</label> -->
<div class="col-sm-6 col-sm-offset-3">
<input class="form-control" type="text" name="username" id="username" placeholder="Username"
autocomplete="username" autocapitalize="off"
ng-model="ctrl.signupForm.username"/>
autocomplete="username" autocapitalize="off" ng-model="ctrl.signupForm.username" />
</div>
<!-- <div class="col-sm-4 form-control-static">
<a ng-click="ctrl.signupForm.username = ctrl.signupForm.email">use email as username</a>
Expand All @@ -86,17 +83,15 @@ <h3 class="text-center">Welcome to Bitraf</h3>
<div class="form-group">
<!-- <label for="phone" class="col-sm-2">Phone</label> -->
<div class="col-sm-6 col-sm-offset-3">
<input class="form-control" type="text" name="phone" id="phone" placeholder="Phone"
autocomplete="phone"
ng-model="ctrl.signupForm.phone"/>
<input class="form-control" type="text" name="phone" id="phone" placeholder="Phone" autocomplete="phone"
ng-model="ctrl.signupForm.phone" />
</div>
</div>
<div class="form-group">
<!-- <label for="password" class="col-sm-2">Password</label> -->
<div class="col-sm-6 col-sm-offset-3">
<input class="form-control" type="password" name="password" id="password" placeholder="Password"
autocomplete="new-password"
ng-model="ctrl.signupForm.password"/>
autocomplete="new-password" ng-model="ctrl.signupForm.password" />
</div>
</div>
<div class="form-group text-center">
Expand All @@ -113,7 +108,8 @@ <h4 class="panel-title">There are more steps!</h4>
<div class="panel-body">
<ul>
<li>Signing up for an account does not automatically start a membership at Bitraf.</li>
<li>You can complete becoming a member by logging in, choosing a membership level, and setting up a credit card.</li>
<li>You can complete becoming a member by logging in, choosing a membership level, and setting up a credit
card.</li>
<li>You can always change or cancel your memebership at any time.</li>
</ul>
</div>
Expand Down Expand Up @@ -148,4 +144,4 @@ <h3 class="modal-title text-center" id="modal-title">Recover password</h3>
<p>{{ ctrl.message }}</p>
<a ng-click="ctrl.dismiss()">Ok!</a>
</div>
</script>
</script>

0 comments on commit 8cd4435

Please sign in to comment.