-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
723922a
commit 061ab38
Showing
12 changed files
with
338 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ Repeat 3 times max | |
When obj.success is true | ||
Finish obj.uid | ||
|
||
Finish false | ||
Finish false |
39 changes: 39 additions & 0 deletions
39
docs/admin/developer/agama/otp-email-registration/confirmation.ftlh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!doctype html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" href="${webCtx.contextPath}/servlet/favicon" type="image/x-icon"> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
<style> | ||
#logo { | ||
max-height: 3.25rem; | ||
margin: 0.5rem; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="d-flex flex-column align-items-center justify-content-between min-vh-100 w-100"> | ||
<header class="d-flex w-100 justify-content-between border-bottom"> | ||
<img id="logo" src="https://gluu.org/wp-content/uploads/2021/02/janssen-project-transparent-630px-182px-300x86.png" /> | ||
</header> | ||
|
||
<div class="row col-sm-10 col-md-5 my-3"> | ||
|
||
<div class="d-flex flex-column align-items-center border border-1 rounded p-5"> | ||
<p class="fs-4 mb-5" align="center">An account has been created for <span class="fw-bold">${username}</span></p> | ||
|
||
<form method="post" enctype="application/x-www-form-urlencoded"> | ||
<input type="submit" class="btn btn-success px-4" value="Proceed to login"> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
<footer class="d-flex flex-column align-items-center w-100 pb-2"> | ||
<hr class="w-75"> | ||
</footer> | ||
</div> | ||
|
||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
...dmin/developer/agama/otp-email-registration/io.jans.flow.sample.otp.emailWithRegistration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Flow io.jans.flow.sample.otp.emailWithRegistration | ||
Basepath "samples/otp-email-registration" | ||
|
||
obj = Trigger io.jans.flow.sample.otp.email | ||
Override templates "samples/basic/login.ftlh" "" | ||
|
||
When obj.aborted is true | ||
//Take the registration path | ||
obj = Trigger io.jans.flow.sample.registration | ||
Override templates "samples/registration/confirmation.ftlh" "" | ||
|
||
When obj.success is true | ||
//Use otp-email registration as is | ||
obj = Trigger io.jans.flow.sample.otp.email | ||
|
||
Finish obj |
Binary file added
BIN
+35.9 KB
.../agama/otp-email-registration/io.jans.flow.sample.otp.emailWithRegistration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions
66
docs/admin/developer/agama/otp-email-registration/login.ftlh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!doctype html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" href="${webCtx.contextPath}/servlet/favicon" type="image/x-icon"> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
<style> | ||
#logo { | ||
max-height: 3.25rem; | ||
margin: 0.5rem; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="d-flex flex-column align-items-center justify-content-between min-vh-100 w-100"> | ||
<header class="d-flex w-100 justify-content-between border-bottom"> | ||
<img id="logo" src="https://gluu.org/wp-content/uploads/2021/02/janssen-project-transparent-630px-182px-300x86.png" /> | ||
</header> | ||
|
||
<div class="row col-sm-10 col-md-5 mb-5 pb-5"> | ||
|
||
<div class="border border-1 rounded mb-5 p-5"> | ||
<p class="fs-4 mb-5">Welcome</p> | ||
|
||
<#if !(success!true)> | ||
<p class="fs-6 text-danger mb-3">${msgs["login.errorMessage"]}</p> | ||
</#if> | ||
|
||
<form method="post" enctype="application/x-www-form-urlencoded"> | ||
<div class="mb-3 row"> | ||
<label for="username" class="col-md-3 col-form-label">${msgs["login.username"]}</label> | ||
<div class="col-md-9"> | ||
<input type="text" class="form-control" name="username" id="username" value="${uid!}" required> | ||
</div> | ||
</div> | ||
<div class="mb-3 row"> | ||
<label for="password" class="col-md-3 col-form-label">${msgs["login.password"]}</label> | ||
<div class="col-md-9"> | ||
<input type="password" class="form-control" id="password" name="password"> | ||
</div> | ||
</div> | ||
<div class="mb-3 row"> | ||
<div class="col-md-12 d-flex justify-content-end"> | ||
<input type="submit" class="btn btn-success px-4" value="${msgs["login.login"]}"> | ||
</div> | ||
</div> | ||
</form> | ||
<form method="post" enctype="application/x-www-form-urlencoded"> | ||
<div class="row d-flex justify-content-center"> | ||
<button type="submit" class="btn btn-link" id="_abort" name="_abort" value=""> | ||
Don't have an account? | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
<footer class="d-flex flex-column align-items-center w-100 pb-2"> | ||
<hr class="w-75"> | ||
</footer> | ||
</div> | ||
|
||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions
38
docs/admin/developer/agama/registration/RegistrationUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.jans.agama.samples; | ||
|
||
import io.jans.agama.engine.script.LogUtils; | ||
import io.jans.as.common.model.common.User; | ||
import io.jans.as.server.service.UserService; | ||
import io.jans.service.cdi.util.CdiUtil; | ||
|
||
import java.util.Date; | ||
|
||
public class RegistrationUtil { | ||
|
||
public static String register(String givenName, String userName, String password, String password2, String email) { | ||
|
||
UserService uss = CdiUtil.bean(UserService.class); | ||
User user = uss.getUser(userName, "uid"); | ||
|
||
if (user != null) return "This account already exists"; | ||
|
||
if (!email.matches(".+@.+")) return "Invalid e-mail address"; | ||
|
||
if (!password2.equals(password)) return "Passwords do not match"; | ||
|
||
user = new User(); | ||
user.setUserId(userName); | ||
user.setAttribute("givenName", givenName); | ||
user.setAttribute("userPassword", password); | ||
user.setAttribute("mail", email); | ||
|
||
try { | ||
uss.addUser(user, true); | ||
} catch (Exception e) { | ||
LogUtils.log("@e ", e.getMessage()); | ||
return "An unexpected error occurred"; | ||
} | ||
return null; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!doctype html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" href="${webCtx.contextPath}/servlet/favicon" type="image/x-icon"> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
<style> | ||
#logo { | ||
max-height: 3.25rem; | ||
margin: 0.5rem; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="d-flex flex-column align-items-center justify-content-between min-vh-100 w-100"> | ||
<header class="d-flex w-100 justify-content-between border-bottom"> | ||
<img id="logo" src="https://gluu.org/wp-content/uploads/2021/02/janssen-project-transparent-630px-182px-300x86.png" /> | ||
</header> | ||
|
||
<div class="row col-sm-10 col-md-5 my-3"> | ||
|
||
<div class="d-flex flex-column align-items-center border border-1 rounded p-5"> | ||
<p class="fs-4 mb-5" align="center">An account has been created for <span class="fw-bold">${username}</span></p> | ||
|
||
<form method="post" enctype="application/x-www-form-urlencoded"> | ||
<input type="submit" class="btn btn-success px-4" value="Continue"> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
<footer class="d-flex flex-column align-items-center w-100 pb-2"> | ||
<hr class="w-75"> | ||
</footer> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!doctype html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" href="${webCtx.contextPath}/servlet/favicon" type="image/x-icon"> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
<style> | ||
#logo { | ||
max-height: 3.25rem; | ||
margin: 0.5rem; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="d-flex flex-column align-items-center justify-content-between min-vh-100 w-100"> | ||
<header class="d-flex w-100 justify-content-between border-bottom"> | ||
<img id="logo" src="https://gluu.org/wp-content/uploads/2021/02/janssen-project-transparent-630px-182px-300x86.png" /> | ||
</header> | ||
|
||
<div class="row col-sm-10 col-md-5 my-3"> | ||
|
||
<div class="border border-1 rounded p-5"> | ||
<p class="fs-4 mb-5">Create your account</p> | ||
|
||
<p class="fs-6 text-danger mb-4">${error!}</p> | ||
|
||
<form method="post" enctype="application/x-www-form-urlencoded"> | ||
<div class="mb-3 row"> | ||
<label for="name" class="col-md-3 col-form-label">First name</label> | ||
<div class="col-md-9"> | ||
<input type="text" class="form-control" name="name" id="name" value="${name!}" required> | ||
</div> | ||
</div> | ||
<div class="mb-3 row"> | ||
<label for="username" class="col-md-3 col-form-label">Username</label> | ||
<div class="col-md-9"> | ||
<input type="text" class="form-control" name="username" id="username" | ||
value="${username!}" required> | ||
</div> | ||
</div> | ||
<div class="mb-3 row"> | ||
<label for="pwd" class="col-md-3 col-form-label">Choose a password</label> | ||
<div class="col-md-9"> | ||
<input type="password" class="form-control" id="pwd" name="pwd" required> | ||
</div> | ||
</div> | ||
<div class="mb-3 row"> | ||
<label for="pwd2" class="col-md-3 col-form-label">Confirm password</label> | ||
<div class="col-md-9"> | ||
<input type="password" class="form-control" id="pwd2" name="pwd2" required> | ||
</div> | ||
</div> | ||
<div class="mb-3 row"> | ||
<label for="email" class="col-md-3 col-form-label">Your e-mail</label> | ||
<div class="col-md-9"> | ||
<input type="email" class="form-control" id="email" name="email" | ||
placeHolder="name@example.com" value="${email!}" required> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-12 d-flex justify-content-end"> | ||
<input type="submit" class="btn btn-success px-4" value="Register"> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
<footer class="d-flex flex-column align-items-center w-100 pb-2"> | ||
<hr class="w-75"> | ||
</footer> | ||
</div> | ||
|
||
</body> | ||
</html> |
18 changes: 18 additions & 0 deletions
18
docs/admin/developer/agama/registration/io.jans.flow.sample.registration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Flow io.jans.flow.sample.registration | ||
Basepath "samples/registration" | ||
|
||
o = {} | ||
Repeat 3 times max | ||
o = RRF "index.ftlh" o | ||
o.error = Call io.jans.agama.samples.RegistrationUtil#register o.name o.username o.pwd o.pwd2 o.email | ||
|
||
When o.error is null | ||
o.pwd = null | ||
o.pwd2 = null | ||
|
||
RRF "confirmation.ftlh" o | ||
Finish true | ||
|
||
Log "Error creating user %" o.error | ||
|
||
Finish false |
Binary file added
BIN
+28.6 KB
docs/admin/developer/agama/registration/io.jans.flow.sample.registration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters