Changeset 51b8d8c613072234b0706d42eff7c28348e68691
- Timestamp:
- 03/22/08 16:05:42
(5 months ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1206198342 +0100
- git-parent:
[598ec69d30cac58c3e0841b7e2a8fff2e037be99]
- git-author:
- Christopher Jung <bktheg@web.de> 1206198342 +0100
- Message:
Login bei Vac gefixt
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r57db917 |
r51b8d8c |
|
| 730 | 730 | @Action(ActionType.DEFAULT) |
|---|
| 731 | 731 | public void loginAction() { |
|---|
| 732 | | Database db = getDatabase(); |
|---|
| | 732 | Database database = getDatabase(); |
|---|
| | 733 | org.hibernate.Session db = getDB(); |
|---|
| 733 | 734 | TemplateEngine t = getTemplateEngine(); |
|---|
| 734 | 735 | |
|---|
| … | … | |
| 742 | 743 | boolean clear = false; |
|---|
| 743 | 744 | |
|---|
| 744 | | String disablelogin = db.first("SELECT disablelogin FROM config").getString("disablelogin"); |
|---|
| | 745 | String disablelogin = database.first("SELECT disablelogin FROM config").getString("disablelogin"); |
|---|
| 745 | 746 | if( !"".equals(disablelogin) ) { |
|---|
| 746 | 747 | username = ""; |
|---|
| … | … | |
| 754 | 755 | if( !"".equals(username) && !"".equals(password) ) { |
|---|
| 755 | 756 | String enc_pw = Common.md5(password); |
|---|
| 756 | | username = db.prepareString(username); |
|---|
| 757 | | |
|---|
| 758 | | SQLResultRow uid = db.first("SELECT id FROM users WHERE un='",username,"'"); |
|---|
| 759 | | if( uid.isEmpty() ) { |
|---|
| | 757 | |
|---|
| | 758 | User user = (User)db.createQuery("from User where un=:username") |
|---|
| | 759 | .setString("username", username) |
|---|
| | 760 | .uniqueResult(); |
|---|
| | 761 | |
|---|
| | 762 | if( user == null ) { |
|---|
| 760 | 763 | t.setVar( "show.msg.login.wrongpassword",1 ); |
|---|
| 761 | 764 | Common.writeLog("login.log", Common.date("j.m.Y H:i:s")+": <"+getRequest().getRemoteAddress()+"> ("+username+") <"+username+"> Password <"+password+"> ***UNGUELTIGER ACCOUNT*** von Browser <"+getRequest().getUserAgent()+">\n"); |
|---|
| … | … | |
| 763 | 766 | } |
|---|
| 764 | 767 | else { |
|---|
| 765 | | User user = (User)getDB().get(User.class, uid.getInt("id")); |
|---|
| 766 | | |
|---|
| 767 | 768 | if( !user.getPassword().equals(enc_pw) ) { |
|---|
| 768 | 769 | t.setVar( "show.msg.login.wrongpassword",1 ); |
|---|
| … | … | |
| 770 | 771 | Common.writeLog("login.log", Common.date("j.m.Y H:i:s")+": <"+getRequest().getRemoteAddress()+"> ("+user.getId()+") <"+username+"> Password <"+password+"> ***LOGIN GESCHEITERT*** von Browser <"+getRequest().getUserAgent()+">\n"); |
|---|
| 771 | 772 | clear = false; |
|---|
| 772 | | } |
|---|
| | 773 | } |
|---|
| 773 | 774 | else if( user.getDisabled() ) { |
|---|
| 774 | 775 | t.setVar("show.login.msg.accdisabled",1); |
|---|
| 775 | | Common.writeLog("login.log", Common.date( "j.m.Y H:i:s")+": <"+getRequest().getRemoteAddress()+"> ("+user.getId()+") <"+username+"> Password <"+password+"> ***ACCOUNT GESPERRT*** von Browser <"+getRequest().getUserAgent()+">\n"); |
|---|
| 776 | | |
|---|
| 777 | | getDB().createQuery("delete from Session where id=?") |
|---|
| | 776 | Common.writeLog("login.log", Common.date( "j.m.Y H:i:s")+": <"+getRequest().getRemoteAddress()+"> ("+user.getId()+") <"+username+"> Password <"+password+"> ***VAC LOGIN*** von Browser <"+getRequest().getUserAgent()+">\n"); |
|---|
| | 777 | |
|---|
| | 778 | db.createQuery("delete from Session where id=?") |
|---|
| 778 | 779 | .setInteger(0, user.getId()) |
|---|
| 779 | 780 | .executeUpdate(); |
|---|
| 780 | 781 | |
|---|
| 781 | 782 | clear = false; |
|---|
| 782 | | } |
|---|
| | 783 | } |
|---|
| | 784 | else if( (user.getVacationCount() > 0) && (user.getWait4VacationCount() == 0) ) { |
|---|
| | 785 | db.createQuery("delete from Session where id=?") |
|---|
| | 786 | .setInteger(0, user.getId()) |
|---|
| | 787 | .executeUpdate(); |
|---|
| | 788 | |
|---|
| | 789 | t.setVar( |
|---|
| | 790 | "show.login.vacmode", 1, |
|---|
| | 791 | "login.vacmode.dauer", Common.ticks2Days(user.getVacationCount()), |
|---|
| | 792 | "login.vacmode.username", username, |
|---|
| | 793 | "login.vacmode.password", password); |
|---|
| | 794 | |
|---|
| | 795 | clear = true; |
|---|
| | 796 | } |
|---|
| 783 | 797 | else { |
|---|
| 784 | 798 | Session session = (Session)getDB().createQuery("from Session where id=? and tick!=0") |
|---|
| … | … | |
| 821 | 835 | getContext().commit(); |
|---|
| 822 | 836 | |
|---|
| 823 | | if( (user.getVacationCount() == 0) || (user.getWait4VacationCount() != 0) ) { |
|---|
| 824 | | t.setVar( "show.login.msg.ok", 1, |
|---|
| 825 | | "login.sess", session.getSession() ); |
|---|
| 826 | | } |
|---|
| 827 | | else { |
|---|
| 828 | | t.setVar( "show.login.vacmode", 1, |
|---|
| 829 | | "login.vacmode.dauer", Common.ticks2Days(user.getVacationCount()), |
|---|
| 830 | | "login.vacmode.sess", session.getSession() ); |
|---|
| 831 | | } |
|---|
| | 837 | t.setVar( "show.login.msg.ok", 1, |
|---|
| | 838 | "login.sess", session.getSession() ); |
|---|
| 832 | 839 | |
|---|
| 833 | 840 | // Ueberpruefen ob das gfxpak noch aktuell ist |
|---|
| … | … | |
| 904 | 911 | public void loginVacmodeDeakAction() { |
|---|
| 905 | 912 | TemplateEngine t = getTemplateEngine(); |
|---|
| 906 | | |
|---|
| 907 | | parameterString("asess"); |
|---|
| 908 | | String sess = getString("asess"); |
|---|
| 909 | | |
|---|
| 910 | | Session session = (Session)getDB().get(Session.class, sess); |
|---|
| 911 | | |
|---|
| 912 | | if( session == null ) { |
|---|
| | 913 | org.hibernate.Session db = getDB(); |
|---|
| | 914 | |
|---|
| | 915 | parameterString("username"); |
|---|
| | 916 | parameterString("pw"); |
|---|
| | 917 | String username = getString("username"); |
|---|
| | 918 | String password = getString("pw"); |
|---|
| | 919 | |
|---|
| | 920 | User user = (User)db.createQuery("from User where un=:username") |
|---|
| | 921 | .setString("username", username) |
|---|
| | 922 | .uniqueResult(); |
|---|
| | 923 | |
|---|
| | 924 | String encPw = Common.md5(password); |
|---|
| | 925 | |
|---|
| | 926 | if( user == null || !encPw.equals(user.getPassword()) ) { |
|---|
| 913 | 927 | t.setVar("show.login.vacmode.msg.accerror",1); |
|---|
| 914 | 928 | return; |
|---|
| 915 | 929 | } |
|---|
| 916 | 930 | |
|---|
| 917 | | User auser = (User)session.getUser(); |
|---|
| 918 | | if( !auser.hasFlag(BasicUser.FLAG_DISABLE_IP_SESSIONS) && !session.isValidIP(getRequest().getRemoteAddress()) ) { |
|---|
| 919 | | t.setVar("show.login.vacmode.msg.accerror",1); |
|---|
| 920 | | return; |
|---|
| 921 | | } |
|---|
| 922 | | |
|---|
| 923 | | if( !auser.hasFlag(BasicUser.FLAG_DISABLE_AUTO_LOGOUT) && (Common.time() - session.getLastAction() > Configuration.getIntSetting("AUTOLOGOUT_TIME")) ) { |
|---|
| 924 | | getDB().delete(session); |
|---|
| 925 | | t.setVar("show.login.vacmode.msg.accerror",1); |
|---|
| 926 | | return; |
|---|
| 927 | | } |
|---|
| 928 | | |
|---|
| 929 | 931 | parameterString("reason"); |
|---|
| 930 | 932 | String reason = getString("reason"); |
|---|
| 931 | 933 | |
|---|
| 932 | | PM.sendToAdmins((User)session.getUser(), "VACMODE-DEAK", |
|---|
| 933 | | "[VACMODE-DEAK]\nMY ID: "+session.getUser().getId()+"\nREASON:\n"+reason, 0); |
|---|
| | 934 | PM.sendToAdmins(user, "VACMODE-DEAK", |
|---|
| | 935 | "[VACMODE-DEAK]\nMY ID: "+user.getId()+"\nREASON:\n"+reason, 0); |
|---|
| 934 | 936 | |
|---|
| 935 | 937 | t.setVar("show.login.vacmode.msg.send",1); |
|---|
| r6ef51f2 |
r51b8d8c |
|
| 294 | 294 | Abschaltung beantragen:<br /> |
|---|
| 295 | 295 | <form action="./ds" method="post"> |
|---|
| 296 | | <input type="hidden" name="asess" value="{login.vacmode.sess}" /> |
|---|
| | 296 | <input type="hidden" name="username" value="{login.vacmode.username}" /> |
|---|
| | 297 | <input type="hidden" name="pw" value="{login.vacmode.password}" /> |
|---|
| 297 | 298 | <input type="hidden" name="action" value="loginVacmodeDeak" /> |
|---|
| 298 | 299 | <input type="hidden" name="module" value="portal" /> |
|---|
| 299 | | <textarea name="reason" rows="5" cols="40">Schüssige Begründung</textarea><br /> |
|---|
| | 300 | <textarea name="reason" rows="5" cols="40">Schlüssige Begründung</textarea><br /> |
|---|
| 300 | 301 | <input type="submit" value="absenden" /> |
|---|
| 301 | 302 | </form> |
|---|