Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
128 additions
and
126 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
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
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 |
---|---|---|
@@ -1,20 +1,12 @@ | ||
component extends="Wheels" output="false" { | ||
public void function init(){ | ||
filters(through="checkLogin", except="admin,login,register,signin,activate"); | ||
} | ||
|
||
// public void function init(){ | ||
// super.init(); | ||
// //filters(through="checkLogin", except="login,register,signin,activate"); | ||
// } | ||
|
||
// // checkLogin | ||
// public void function checkLogin(){ | ||
// if(!structKeyExists(session, "user")){ | ||
// redirectTo(controller="dashboard", action="login"); | ||
// } | ||
// } | ||
|
||
// public void function redirectStudent (){ | ||
// if (session.user.roleid GT 2){ | ||
// redirectTo(controller = "main", action = "home"); | ||
// } | ||
// } | ||
// checkLogin | ||
public void function checkLogin(){ | ||
if(!structKeyExists(session, "stuser")){ | ||
redirectTo(controller="main", action="login"); | ||
} | ||
} | ||
} |
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,14 @@ | ||
component extends="Controller" output="false" { | ||
public void function init(){ | ||
//super.init(); | ||
provides("html,xml,json,csv"); | ||
} | ||
public void function export(){ | ||
output = model("students").findAll(); | ||
if(params.format == 'json'){ | ||
renderWith(data=output); | ||
} | ||
|
||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,9 +1,43 @@ | ||
component extends="Controller" output="false" { | ||
public void function init(){ | ||
//super.init(); | ||
|
||
} | ||
public void function home(){ | ||
public void function home(){ | ||
output="Studenten pagina"; | ||
} | ||
|
||
} | ||
public void function login(){ | ||
//initialize model | ||
stuser = model("student").new(); | ||
|
||
} | ||
public void function logout(){ | ||
if(structKeyExists(session, "stuser")){ | ||
StructDelete(session, "stuser"); | ||
} | ||
redirectTo(controller="main", action="login"); | ||
} | ||
public void function signin(){ | ||
|
||
if (len(params.stuser.password) eq 0){ | ||
params.stuser.password = "0"; | ||
} | ||
//find a modelobject | ||
stuser = model("student").findOne(where="email='#params.stuser.email#' AND password='#params.stuser.password#'"); | ||
|
||
if (IsObject(stuser)){ | ||
renderPage(action="login"); | ||
session.stuser.id = stuser.id; | ||
session.stuser.name = stuser.name; | ||
session.stuser.roleid = 3; | ||
redirectTo(controller="main", action="home"); | ||
|
||
}else{ | ||
stuser = model("student").new(email=params.stuser.email); | ||
flashInsert(error="The email and password you entered are not valid."); | ||
renderPage(action="login"); | ||
} | ||
|
||
} | ||
} |
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
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
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
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,5 @@ | ||
<cfoutput> | ||
#textField(label="Email", objectName="stuser", property="email")# | ||
#passwordField(label="Password", objectName="stuser", property="password")# | ||
#submitTag(class='btn', value='Log In')# | ||
</cfoutput> |
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,13 @@ | ||
<cfoutput> | ||
<cfif flashKeyExists("success")> | ||
<div class="success"> | ||
#flash("success")# | ||
</div> | ||
</cfif> | ||
<cfif flashKeyExists("error")> | ||
<div class="error"> | ||
#flash("error")# | ||
</div> | ||
</cfif> | ||
</cfoutput> | ||
|
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,7 @@ | ||
<cfoutput> | ||
<h1>Login</h1> | ||
#includePartial("showFlash")# | ||
#startFormTag(controller="main", action="Signin")# | ||
#includePartial("form")# | ||
#endFormTag()# | ||
</cfoutput> |