schema/spacewalk
by Milan Zazrivec
schema/spacewalk/spacewalk-schema-upgrade | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit d5ab39faf8ee6c7d6f17b9b0aaa07de8a2c87110
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Oct 24 11:51:49 2013 +0200
fix space check for Oracle schema upgrades
This fix is to make sure the bytes will not get converted to scientific
notation (for large values).
diff --git a/schema/spacewalk/spacewalk-schema-upgrade b/schema/spacewalk/spacewalk-schema-upgrade
index 930a10d..91e8910 100755
--- a/schema/spacewalk/spacewalk-schema-upgrade
+++ b/schema/spacewalk/spacewalk-schema-upgrade
@@ -82,12 +82,12 @@ if (-f $schema_banner and -s $schema_banner) {
if ($options{db_backend} eq 'oracle') {
my $default_tablespace = get_default_oracle_tablespace();
my $used_space = run_query(<<EOF);
- select sum(bytes)
+ select sum(bytes / 1048576)
from user_segments
where tablespace_name = '$default_tablespace';
EOF
my $free_space = run_query(<<EOF);
- select sum(bytes)
+ select sum(bytes / 1048576)
from user_free_space
where tablespace_name = '$default_tablespace';
EOF
@@ -98,8 +98,8 @@ EOF
for (1 .. 72) { $usage .= '-'; } $usage .= "\n";
$usage .= sprintf("%+15s %15.2f %15.2f %15.2f",
$default_tablespace,
- $used_space/1024/1024,
- $free_space/1024/1024,
+ $used_space,
+ $free_space,
$used_space * 100 / ($used_space + $free_space));
print <<EOF;
8 years, 8 months
Changes to 'refs/tags/spacewalk-schema-2.1.23-1'
by Milan Zazrivec
Tag 'spacewalk-schema-2.1.23-1' created by Milan Zazrivec <mzazrivec(a)redhat.com> at 2013-10-24 08:34 +0000
Tagging package [spacewalk-schema] version [2.1.23-1] in directory [schema/spacewalk/].
Changes since spacewalk-web-2.1.28-1:
Milan Zazrivec (2):
schema upgrade fix: explicit cast for bit-wise operand
Automatic commit of package [spacewalk-schema] release [2.1.23-1].
---
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/032-fix-supplements-enhances.sql.postgresql | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
---
8 years, 8 months
rel-eng/packages schema/spacewalk
by Milan Zazrivec
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 28958bafb15dbe90ca0dd36f9a10ac41fffc471a
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Oct 24 10:34:51 2013 +0200
Automatic commit of package [spacewalk-schema] release [2.1.23-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index dab0968..dfcfd01 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-2.1.22-1 schema/spacewalk/
+2.1.23-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index bdb33a5..55ba61c 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -4,7 +4,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 2.1.22
+Version: 2.1.23
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -71,6 +71,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-sql*
%changelog
+* Thu Oct 24 2013 Milan Zazrivec <mzazrivec(a)redhat.com> 2.1.23-1
+- schema upgrade fix: explicit cast for bit-wise operand
+
* Tue Oct 22 2013 Michael Mraka <michael.mraka(a)redhat.com> 2.1.22-1
- Regenerate the metadata for rpm enhances dependency (bnc#846436)
- add support for enhances rpm weak dependency (schema) (bnc#846436)
8 years, 8 months
schema/spacewalk
by Milan Zazrivec
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/032-fix-supplements-enhances.sql.postgresql | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 8dadb6de15cbf6e2cf6bbeabe7a77de2b05da110
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Oct 24 10:32:47 2013 +0200
schema upgrade fix: explicit cast for bit-wise operand
This is to fix the following error:
psql:/var/log/spacewalk/schema-upgrade/20131022-181452-script.sql:4949: ERROR: operator does not exist: numeric & integer
LINE 4: where (s.sense & 134217728) != 134217728;
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/032-fix-supplements-enhances.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/032-fix-supplements-enhances.sql.postgresql
index d563b23..d441545 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/032-fix-supplements-enhances.sql.postgresql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/032-fix-supplements-enhances.sql.postgresql
@@ -3,7 +3,7 @@
insert into rhnPackageEnhances (package_id, capability_id, sense)
select s.package_id, s.capability_id, s.sense
from rhnPackageSupplements s
- where (s.sense & 134217728) != 134217728;
+ where (s.sense::bigint & 134217728) != 134217728;
-- 134217728 == (1 << 27) STRONG FLAG in RPM
delete from rhnPackageSupplements
8 years, 8 months
Changes to 'refs/tags/spacewalk-web-2.1.28-1'
by Jan Dobes
Tag 'spacewalk-web-2.1.28-1' created by Jan Dobes <jdobes(a)redhat.com> at 2013-10-24 07:33 +0000
Tagging package [spacewalk-web] version [2.1.28-1] in directory [web/].
Changes since spacewalk-java-2.1.61-1:
Jan Dobes (1):
Automatic commit of package [spacewalk-web] release [2.1.28-1].
---
rel-eng/packages/spacewalk-web | 2 +-
web/spacewalk-web.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
---
8 years, 8 months
rel-eng/packages web/spacewalk-web.spec
by Jan Dobes
rel-eng/packages/spacewalk-web | 2 +-
web/spacewalk-web.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit bc849b13298f2baf50df9c9b629af30a60f287f0
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Thu Oct 24 09:33:48 2013 +0200
Automatic commit of package [spacewalk-web] release [2.1.28-1].
diff --git a/rel-eng/packages/spacewalk-web b/rel-eng/packages/spacewalk-web
index 7d05402..73b3f82 100644
--- a/rel-eng/packages/spacewalk-web
+++ b/rel-eng/packages/spacewalk-web
@@ -1 +1 @@
-2.1.27-1 web/
+2.1.28-1 web/
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index d485008..061eb60 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -4,7 +4,7 @@ Name: spacewalk-web
Summary: Spacewalk Web site - Perl modules
Group: Applications/Internet
License: GPLv2
-Version: 2.1.27
+Version: 2.1.28
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk/
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -269,6 +269,10 @@ rm -rf $RPM_BUILD_ROOT
%doc LICENSE
%changelog
+* Thu Oct 24 2013 Jan Dobes 2.1.28-1
+- 1015747 - cleanup
+- 1015747 - new jsp page + nav stuff
+
* Wed Oct 23 2013 Michael Mraka <michael.mraka(a)redhat.com> 2.1.27-1
- report package arch in Event History
8 years, 8 months
Changes to 'refs/tags/spacewalk-java-2.1.61-1'
by Jan Dobes
Tag 'spacewalk-java-2.1.61-1' created by Jan Dobes <jdobes(a)redhat.com> at 2013-10-24 07:32 +0000
Tagging package [spacewalk-java] version [2.1.61-1] in directory [java/].
Changes since spacewalk-java-2.1.60-1:
Jan Dobes (5):
1015747 - new jsp page + nav stuff
1015747 - page handling
1015747 - resources
1015747 - cleanup
Automatic commit of package [spacewalk-java] release [2.1.61-1].
---
java/code/src/com/redhat/rhn/domain/user/UserFactory.java | 13
java/code/src/com/redhat/rhn/domain/user/legacy/UserImpl.hbm.xml | 4
java/code/src/com/redhat/rhn/frontend/action/help/ForgotCredentialsAction.java | 258 +++++++++
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 18
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 29 +
java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_en_US.xml | 57 ++
java/code/webapp/WEB-INF/nav/sitenav.xml | 2
java/code/webapp/WEB-INF/pages/help/forgotcredentials.jsp | 70 ++
java/code/webapp/WEB-INF/struts-config.xml | 19
java/spacewalk-java.spec | 7
rel-eng/packages/spacewalk-java | 2
web/conf/rhn_web.conf | 3
web/html/help/forgot_password.pxt | 63 --
web/include/formletters/forgot_accounts.xml | 20
web/include/formletters/forgot_password.xml | 20
web/include/nav/sitenav.xml | 2
web/modules/rhn/RHN/DB/TemplateString.pm | 196 -------
web/modules/rhn/RHN/Postal.pm | 275 ----------
web/modules/rhn/RHN/TemplateString.pm | 24
web/modules/sniglets/Sniglets/Users.pm | 79 --
web/spacewalk-web.spec | 2
21 files changed, 477 insertions(+), 686 deletions(-)
---
8 years, 8 months
java/spacewalk-java.spec rel-eng/packages
by Jan Dobes
java/spacewalk-java.spec | 7 ++++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit 95e371e86ba6316f8ee87f5b0734f0275de8d2c8
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Thu Oct 24 09:32:28 2013 +0200
Automatic commit of package [spacewalk-java] release [2.1.61-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 27eedf4..16fc52c 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -28,7 +28,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 2.1.60
+Version: 2.1.61
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -785,6 +785,11 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Thu Oct 24 2013 Jan Dobes 2.1.61-1
+- 1015747 - resources
+- 1015747 - page handling
+- 1015747 - new jsp page + nav stuff
+
* Wed Oct 23 2013 Michael Mraka <michael.mraka(a)redhat.com> 2.1.60-1
- added messages for SystemRemoteCommandAction.java
- reformated xliff file using xmllint
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 42bfe71..79447bb 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-2.1.60-1 java/
+2.1.61-1 java/
8 years, 8 months
4 commits - java/code web/conf web/html web/include web/modules web/spacewalk-web.spec
by Jan Dobes
java/code/src/com/redhat/rhn/domain/user/UserFactory.java | 13
java/code/src/com/redhat/rhn/domain/user/legacy/UserImpl.hbm.xml | 4
java/code/src/com/redhat/rhn/frontend/action/help/ForgotCredentialsAction.java | 258 +++++++++
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 18
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 29 +
java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_en_US.xml | 57 ++
java/code/webapp/WEB-INF/nav/sitenav.xml | 2
java/code/webapp/WEB-INF/pages/help/forgotcredentials.jsp | 70 ++
java/code/webapp/WEB-INF/struts-config.xml | 19
web/conf/rhn_web.conf | 3
web/html/help/forgot_password.pxt | 63 --
web/include/formletters/forgot_accounts.xml | 20
web/include/formletters/forgot_password.xml | 20
web/include/nav/sitenav.xml | 2
web/modules/rhn/RHN/DB/TemplateString.pm | 196 -------
web/modules/rhn/RHN/Postal.pm | 275 ----------
web/modules/rhn/RHN/TemplateString.pm | 24
web/modules/sniglets/Sniglets/Users.pm | 79 --
web/spacewalk-web.spec | 2
19 files changed, 470 insertions(+), 684 deletions(-)
New commits:
commit 751a09283e75b432490ad0ed721838d2639ff83c
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Wed Oct 23 21:37:50 2013 +0200
1015747 - cleanup
diff --git a/web/conf/rhn_web.conf b/web/conf/rhn_web.conf
index b5392e8..80ef860 100644
--- a/web/conf/rhn_web.conf
+++ b/web/conf/rhn_web.conf
@@ -39,9 +39,6 @@ web.enable_oai_sync = 0
# use crypt(3) for passwords in database
web.encrypted_passwords = 1
-# Directory where RHN::Postal searches for formletters.
-web.formletter_dir = /var/www/html/formletters
-
# Hour of the day, in EST24, that the throttling of freeloaders ends
web.freeloader_throttle_end = 17
diff --git a/web/html/help/forgot_password.pxt b/web/html/help/forgot_password.pxt
deleted file mode 100644
index 3b9c076..0000000
--- a/web/html/help/forgot_password.pxt
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<pxt-passthrough>
- <pxt-use class="Grail::Frame" />
-
- <grail-canvas-template base="/templates/c.pxt" mode="main_canvas">
-
-<h1>Login Information</h1>
-
-<pxt-include-late file="/network/components/message_queues/local.pxi" />
- <h2>Password Unknown</h2>
- <p>If you do not know your password, please enter your <pxt-config var="product_name" /> login and email address below and your password will be reset and sent to you.</p>
- <pxt-use class="Sniglets::Users" />
- <pxt-form method="post">
- <table class="details">
- <rhn-login-form>
- <tr>
- <th><pxt-config var="product_name" /> Login:</th>
-
- <td>
- <input type="text" name="username" size="20" maxlength="120" value="" />
- </td>
- </tr>
-
- <tr>
- <th>Email Address:</th>
-
- <td>
- <input type="text" name="email" size="20" maxlength="120" value="" />
- </td>
- </tr>
- </rhn-login-form>
- </table>
-
-<div align="right">
-<hr />
-<input type="submit" value="Send Password" />
-</div>
-<input type="hidden" name="pxt:trap" value="rhn:forgot_password_cb" />
- </pxt-form>
-
- <h2><pxt-config var="product_name" /> Login Unknown</h2>
-
- <p>If you do not know your <pxt-config var="product_name" /> login, please enter your email address below and your <pxt-config var="product_name" /> login will be sent to you.</p>
- <pxt-form method="post">
- <table class="details">
- <tr>
- <th>Email Address:</th>
-
- <td>
- <input type="text" name="email" size="20" maxlength="120" value="" />
- </td>
- </tr>
- </table>
-
-<div align="right">
-<hr />
-<input type="submit" value="Send Login" />
-</div>
-<input type="hidden" name="pxt:trap" value="rhn:forgot_accounts_cb" />
- </pxt-form>
- </grail-canvas-template>
-</pxt-passthrough>
-
diff --git a/web/include/formletters/forgot_accounts.xml b/web/include/formletters/forgot_accounts.xml
deleted file mode 100644
index 175a5da..0000000
--- a/web/include/formletters/forgot_accounts.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<postal-letter subject="&product_name; Login Information">
-[ This is an automated email sent to <email-address /> at your request. ]
-
-You have requested a list of all <product-name /> logins associated
-with the email address <email-address />.
-
-Existing login(s):
-<account-list />
-
-You may reset the passwords for any of the above Red Hat logins at:
-
- https://<postal-template-replace label="hostname" default=" unknown hostname " />/help/forgot_password.pxt
-
-If you continue to have difficulties logging in, please contact
-your <product-name /> administrator for further assistance.
-If you did not request this email be sent, please disregard this message.
-
-Thank you for using <product-name />.
-<postal-template-replace label="email_footer"/>
-</postal-letter>
diff --git a/web/include/formletters/forgot_password.xml b/web/include/formletters/forgot_password.xml
deleted file mode 100644
index 51a22b4..0000000
--- a/web/include/formletters/forgot_password.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<postal-letter subject="&product_name; Password Reset">
-[ This is an automated email sent to <email-address /> at your request. ]
-
-Your <product-name /> password has been reset. To sign in, go to:
-
-https://<postal-template-replace label="hostname" default=" unknown hostname " />/
-
-And use the following username and password:
-
-Username: <username />
-Password: <password />
-
-Once you have logged in, you may then change your password.
-
-If you continue to have difficulties logging in, please contact
-your <product-name /> administrator for further assistance.
-
-Thank you for using <product-name />.
-<postal-template-replace label="email_footer"/>
-</postal-letter>
diff --git a/web/modules/rhn/RHN/DB/TemplateString.pm b/web/modules/rhn/RHN/DB/TemplateString.pm
deleted file mode 100644
index 97cbb4c..0000000
--- a/web/modules/rhn/RHN/DB/TemplateString.pm
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# Copyright (c) 2008--2012 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use strict;
-
-package RHN::DB::TemplateString;
-
-use RHN::DB;
-use RHN::DB::TableClass;
-
-use RHN::Exception qw/throw/;
-use Params::Validate;
-Params::Validate::validation_options(strip_leading => "-");
-
-my @ts_fields = qw/ID CATEGORY_ID LABEL VALUE DESCRIPTION CREATED:longdate MODIFIED:longdate/;
-my @tc_fields = qw/LABEL DESCRIPTION/;
-
-my $ts_table = new RHN::DB::TableClass("rhnTemplateString", "TS", "", @ts_fields);
-my $tc_table = new RHN::DB::TableClass("rhnTemplateCategory", "TC", "category", @tc_fields);
-
-my $j = $ts_table->create_join([$tc_table],
- { rhnTemplateString =>
- { rhnTemplateString => [ "ID", "ID" ],
- rhnTemplateCategory => [ "CATEGORY_ID", "ID" ],
- } } );
-
-# build some accessors
-foreach my $field ($j->method_names) {
-
- my $sub = q{
- sub [[field]] {
- my $self = shift;
- if (@_ and "[[field]]" ne "id") {
- $self->{":modified:"}->{[[field]]} = 1;
- $self->{__[[field]]__} = shift;
- }
- return $self->{__[[field]]__};
- }
- };
-
- $sub =~ s/\[\[field\]\]/$field/g;
- eval $sub;
-
- if ($@) {
- die $@;
- }
-}
-
-sub lookup {
- my $class = shift;
- my %params = validate(@_, {id => 1});
- my $id = $params{id};
-
- my @columns;
-
- my $dbh = RHN::DB->connect;
- my $query = $j->select_query("TS.ID = ?");
-
- my $sth = $dbh->prepare($query);
- $sth->execute($id);
- @columns = $sth->fetchrow;
- $sth->finish;
-
- my $ret;
- if ($columns[0]) {
- $ret = $class->_blank_templatestring();
- foreach ($j->method_names) {
- $ret->{"__${_}__"} = shift @columns;
- }
-
- delete $ret->{":modified:"};
- }
- else {
- throw "No string with id '$id' found\n";
- }
-
- return $ret;
-}
-
-
-sub _blank_templatestring {
- my $class = shift;
-
- my $self = bless { }, $class;
- return $self;
-}
-
-#just get a string by id or label - don't bother with loading the object
-sub get_string {
- my $class = shift;
- my %params = validate(@_, {id => 0, label => 0});
-
- my $query;
- my %q_params;
-
- if (my $id = $params{id}) {
- $query = 'SELECT value FROM rhnTemplateString WHERE id = :id';
- $q_params{id} = $id;
- }
- elsif (my $label = $params{label}) {
- $query = 'SELECT value FROM rhnTemplateString WHERE label = :label';
- $q_params{label} = $label;
- }
- else {
- throw "No id or label.";
- }
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare($query);
- $sth->execute_h(%q_params);
-
- my ($value) = $sth->fetchrow;
- $sth->finish;
-
- return $value;
-}
-
-#load all label/value pairs
-sub load_all {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query = <<EOQ;
-SELECT TS.label, TS.value
- FROM rhnTemplateString TS
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute;
-
- my %strings;
-
- while (my ($key, $value) = $sth->fetchrow) {
- $strings{$key} = $value || '';
- }
-
- return %strings;
-}
-
-sub commit {
- my $self = shift;
- my $dbh = shift || RHN::DB->connect;
- my $mode = 'update';
-
- if ($self->id == -1) {
- my $sth = $dbh->prepare("SELECT sequence_nextval('rhn_template_str_id_seq') FROM DUAL");
- $sth->execute;
- my ($id) = $sth->fetchrow;
- die "No id from rhn_template_str_id_seq (possible error: " . $sth->errstr . ")" unless $id;
- $sth->finish;
-
- $self->{":modified:"}->{id} = 1;
- $self->{__id__} = $id;
- $mode = 'insert';
- }
-
- die "$self->commit called without valid id" unless $self->id and $self->id > 0;
-
- my @modified = keys %{$self->{":modified:"}};
- my %modified = map { $_ => 1 } @modified;
-
- return unless @modified;
-
- my $query;
- if ($mode eq 'update') {
- $query = $ts_table->update_query($ts_table->methods_to_columns(@modified));
- $query .= "TS.ID = ?";
- }
- else {
- $query = $ts_table->insert_query($ts_table->methods_to_columns(@modified));
- }
-
- my $sth = $dbh->prepare($query);
-
- $sth->execute((map { $self->$_() } grep { $modified{$_} } $ts_table->method_names), ($mode eq 'update') ? ($self->id) : ());
-
- $dbh->commit;
-
- delete $self->{":modified:"};
-}
-
-1;
diff --git a/web/modules/rhn/RHN/Postal.pm b/web/modules/rhn/RHN/Postal.pm
deleted file mode 100644
index 7d09f60..0000000
--- a/web/modules/rhn/RHN/Postal.pm
+++ /dev/null
@@ -1,275 +0,0 @@
-#
-# Copyright (c) 2008--2011 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::Postal;
-use strict;
-
-use PXT::Parser;
-use PXT::Config;
-use RHN::Mail;
-use RHN::TemplateString;
-use Text::Wrap qw/wrap/;
-use PXT::Utils ();
-
-my @allowed_params = qw/wrap_body allow_all_domains/;
-
-sub new {
- my $class = shift;
- my %attr = @_;
-
- my $self = bless { wrap => 0,
- allow_all_domains => 0 }, $class;
-
- foreach my $param (@allowed_params) {
- if (exists $attr{$param}) {
- $self->$param($attr{$param});
- }
- }
-
- return $self;
-}
-
-sub template {
- my $self = shift;
- my $filename = shift;
- my $absolute = shift;
-
- my $full_filename;
- if (not $absolute) {
- die "invalid filename, must be server root relative"
- if $filename =~ m(^/) or $filename =~ m(\.\.);
-
- my $basedir = PXT::Config->get('formletter_dir');
- $full_filename = "$basedir/$filename";
- }
- else {
- $full_filename = $filename;
- }
-
- local * FH;
- open FH, '<', $full_filename
- or die "Can't open $full_filename: $!";
-
- local $/ = undef;
- my $body = <FH>;
-
- close FH;
-
- $self->{original_body} = $body;
-}
-
-sub set_tag {
- my $self = shift;
- my $tag = shift;
- my $val = shift;
-
- $self->{tags}->{$tag} = $val;
-}
-
-sub subject {
- my $self = shift;
- my $subject = shift;
-
- if (defined $subject) {
- $self->{subject} = $subject;
- }
-
- return $self->{subject};
-}
-
-sub to {
- my $self = shift;
- my $to = shift;
-
- $self->{to} = $to;
-}
-
-sub from {
- my $self = shift;
- my $from = shift;
-
- $self->{from} = $from;
-}
-
-sub bcc {
- my $self = shift;
- my $bcc = shift;
-
- $self->{bcc} = $bcc;
-}
-
-sub cc {
- my $self = shift;
- my @ccs = @_;
-
- my $cc = join(', ', @ccs);
-
- $self->{cc} = $cc;
-}
-
-sub sendmail_from {
- my $self = shift;
- my $from = shift;
-
- $self->{sendmail_from} = $from;
-}
-
-sub set_header {
- my $self = shift;
- my $h = shift;
- my $v = shift;
-
- $self->{headers}->{$h} = $v;
-}
-
-sub render {
- my $self = shift;
-
- die "Missing required params"
- unless exists $self->{original_body};
-
- my $p = new PXT::Parser;
-
- $p->register_tag("postal-letter" =>
- sub {
- my %params = @_;
- if (exists $params{subject}) {
- my $subject = $params{subject};
- my $product_name = PXT::Config->get('product_name');
- $subject =~ s!&product_name;!$product_name!g;
- $self->subject($subject);
- }
- return $params{__block__};
- }
- );
-
- $p->register_tag("postal-comment" =>
- sub {
- return '';
- }
- );
-
- $p->register_tag("postal-template-replace" => \&template_replace, -5);
- $p->register_tag("postal-template-block" => \&template_block, -5);
-
- foreach my $t (keys %{$self->{tags}}) {
- $p->register_tag($t => sub { $self->{tags}->{$t} });
- }
-
- foreach my $t (keys %{$self->{hidden_tags}}) {
- $p->register_tag($t => sub { '' });
- }
-
- foreach my $t (keys %{$self->{passthrough_tags}}) {
- $p->register_tag($t => sub { my %params = @_; $params{__block__} || '' });
- }
-
- $self->{current_body} = $self->{original_body};
- $p->expand_tags(\$self->{current_body});
-
- die "No pre-defined or inline subject" if not exists $self->{subject};
-}
-
-sub current_body {
- my $self = shift;
-
- die "Body not yet rendered"
- unless exists $self->{current_body};
-
- return $self->{current_body};
-}
-
-sub wrap_body {
- my $self = shift;
-
- $self->{wrap} = 1;
-}
-
-sub allow_all_domains {
- my $self = shift;
- my $flag = shift;
-
- if (defined $flag) {
- $self->{allow_all_domains} = $flag;
- }
-
- return $self->{allow_all_domains};
-}
-
-sub send {
- my $self = shift;
- my %params = @_;
- my $slow = $params{-slow} || 0;
-
- $self->set_header("X-RHN-Email" => $self->{to});
- my $username = $self->{tags}->{username} || $self->{tags}->{login};
- $self->set_header("X-RHN-Login" => $username)
- if defined $username;
-
- die "Body not yet rendered"
- unless exists $self->{current_body};
- die "No recipient specified"
- unless exists $self->{to};
-
- my $subject = $self->{subject};
- $subject = PXT::Utils->perform_substitutions($subject, $self->{tags});
- my $body = $self->{current_body};
-
- if ($self->{wrap}) {
- $body = wrap("", "", $body);
- }
- RHN::Mail->send(to => $self->{to},
- subject => $subject,
- body => $body,
- sendmail_from => $self->{sendmail_from},
- from => $self->{from},
- cc => $self->{cc},
- bcc => $self->{bcc},
- slow => $slow,
- headers => $self->{headers} || { },
- allow_all_domains => $self->allow_all_domains);
-}
-
-sub template_replace {
- my %params = @_;
-
- my $label = $params{label};
- my $default = $params{default};
- die "No label." unless $label;
-
- if ($params{__block__}) {
- return $params{__block__};
- }
-
- my $from_db = RHN::TemplateString->get_string(-label => $label);
-
- # if a default was specified in the .xml file,
- # and no override is found in the db, return the .xml's default
- if ($default and not $from_db) {
- return $default;
- }
-
- return $from_db;
-}
-
-sub template_block {
- my %params = @_;
-
- my %subst = RHN::TemplateString->load_all;
-
- return PXT::Utils->perform_substitutions($params{__block__}, \%subst);
-}
-
-1;
diff --git a/web/modules/rhn/RHN/TemplateString.pm b/web/modules/rhn/RHN/TemplateString.pm
deleted file mode 100644
index a6839f5..0000000
--- a/web/modules/rhn/RHN/TemplateString.pm
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use strict;
-
-package RHN::TemplateString;
-
-use RHN::DB::TemplateString;
-our @ISA = qw/RHN::DB::TemplateString/;
-
-1;
-
diff --git a/web/modules/sniglets/Sniglets/Users.pm b/web/modules/sniglets/Sniglets/Users.pm
index 11aeed3..278d268 100644
--- a/web/modules/sniglets/Sniglets/Users.pm
+++ b/web/modules/sniglets/Sniglets/Users.pm
@@ -23,8 +23,6 @@ use RHN::User;
use RHN::Org;
use PXT::HTML;
use RHN::Mail;
-use RHN::Postal;
-use RHN::TemplateString;
use PXT::ACL;
use Mail::RFC822::Address;
use URI;
@@ -55,9 +53,6 @@ sub register_callbacks {
my $class = shift;
my $pxt = shift;
- $pxt->register_callback('rhn:forgot_password_cb', \&forgot_password_cb);
- $pxt->register_callback('rhn:forgot_accounts_cb', \&forgot_accounts_cb);
-
$pxt->register_callback('rhn:user_prefs_edit_cb' => \&user_prefs_edit_cb);
}
@@ -180,80 +175,6 @@ sub rhn_login_form {
return $body;
}
-sub forgot_password_cb {
- my $pxt = shift;
-
- my $user = RHN::User->lookup(-username => $pxt->dirty_param('username'));
- my $email = $pxt->dirty_param('email');
-
- my $previous_request = $pxt->session->get('previous_password_request');
- if ($previous_request) {
- if (uc($previous_request->{email}) eq uc($email) and
- $previous_request->{username} eq $pxt->dirty_param('username') and
- time - $previous_request->{time} < 60) {
- warn "attempt to rerequest password reset; ignoring";
- $pxt->push_message(site_info => 'Email sent.');
- return;
- }
- }
-
- if ($user and uc($user->email) eq uc($email)) {
- my $password = PXT::Utils->random_password(12);
- my $username = $user->login;
-
- $user->set_password($password);
- $user->commit;
-
- my $letter = new RHN::Postal;
- $letter->template("forgot_password.xml");
- $letter->set_tag('email-address' => $email);
- $letter->set_tag('product-name' => PXT::Config->get('product_name'));
- $letter->set_tag('username' => $username);
- $letter->set_tag('password' => $password);
- $letter->render;
- $letter->to($email);
-
- $pxt->session->set(previous_password_request => {email => $email, username => $pxt->dirty_param('username'), time => time });
-
- $pxt->push_message(site_info => 'Email sent.');
- $letter->send;
- }
- else {
- $pxt->push_message(local_alert => 'Either that username does not exist, or the supplied email address does not match our records.');
- }
-}
-
-sub forgot_accounts_cb {
- my $pxt = shift;
-
- my $email = $pxt->dirty_param('email');
- my @users = sort { $a->login_uc cmp $b->login_uc } map { RHN::User->lookup(-id => $_->[0]) } RHN::User->users_by_email($email);
-
- my $last_req = $pxt->session->get('previous_account_request');
- if ($last_req and time - $last_req < 300) {
- $pxt->push_message(site_info => "An email has already been sent; you may only request your account list every five minutes.");
- return;
- }
- if (not @users) {
- $pxt->push_message(site_info => 'There are no registered accounts with that email address.');
- return;
- }
-
- $pxt->session->set('previous_account_request' => time);
- my $letter = new RHN::Postal;
- $letter->template("forgot_accounts.xml");
- $letter->set_tag('email-address' => $email);
- $letter->set_tag('product-name' => PXT::Config->get('product_name'));
- $letter->set_tag('account-list' => join("\n", map { " " . $_->login } @users));
- $letter->set_header("X-RHN-Info" => "account_list");
- $letter->render;
- $letter->to($email);
-
- $pxt->push_message(site_info => 'Email sent.');
-
- $letter->send;
-}
-
sub user_prefs_edit_cb {
my $pxt = shift;
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 4dbb812..d485008 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -197,7 +197,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/Org.pm
%{perl_vendorlib}/RHN/Package.pm
%{perl_vendorlib}/RHN/Package/
-%{perl_vendorlib}/RHN/Postal.pm
%{perl_vendorlib}/RHN/Profile.pm
%{perl_vendorlib}/RHN/SCDB.pm
%{perl_vendorlib}/RHN/SatCluster.pm
@@ -214,7 +213,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/SystemSnapshot.pm
%{perl_vendorlib}/RHN/TSDB.pm
%{perl_vendorlib}/RHN/Tag.pm
-%{perl_vendorlib}/RHN/TemplateString.pm
%{perl_vendorlib}/RHN/Token.pm
%{perl_vendorlib}/RHN/User.pm
%{perl_vendorlib}/RHN/Utils.pm
commit 0f0d9a09711fb5fdeb1bfea7ddbeb6f963c31da6
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Wed Oct 23 16:50:02 2013 +0200
1015747 - resources
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 827d626..841b936 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -7759,6 +7759,24 @@ tree will not be usable for kickstarting.
<trans-unit id="images.message.success.scheduled">
<source>Image deployment scheduled: {0}</source>
</trans-unit>
+ <trans-unit id="help.credentials.rerequest">
+ <source>An email has already been sent. You may request this action only every {0} seconds.</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.passwordsent">
+ <source>New password sent to {0}.</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.invalidemail">
+ <source>Supplied email address and login do not match.</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.invalidlogin">
+ <source>Supplied login does not exist.</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.nologins">
+ <source>There are no registered accounts with that email address.</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.loginssent">
+ <source>Found login(s) sent to {0}.</source>
+ </trans-unit>
</body>
</file>
</xliff>
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 9669c0c..ff300b7 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -20543,6 +20543,35 @@ given channel.</source>
<source>This master did not export any of its organizations to this slave</source>
</trans-unit>
</group>
+ <group>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/help/ForgotCredentials.do</context>
+ </context-group>
+ <trans-unit id="help.credentials.jsp.passwordreset">
+ <source>Password Reset</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.jsp.logininfo">
+ <source>Login Information</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.jsp.passwordtip">
+ <source>If you do not know your password, please enter your @@PRODUCT_NAME@@ login and email address below and your password will be reset and sent to you.</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.jsp.loginstip">
+ <source>If you do not know your @@PRODUCT_NAME@@ login, please enter your email address below and your @@PRODUCT_NAME@@ login will be sent to you.</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.jsp.passwordbutton">
+ <source>Send Password</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.jsp.loginbutton">
+ <source>Send Login(s)</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.jsp.emailinput">
+ <source>Email Address:</source>
+ </trans-unit>
+ <trans-unit id="help.credentials.jsp.logininput">
+ <source>@@PRODUCT_NAME@@ Login:</source>
+ </trans-unit>
+ </group>
</body>
</file>
</xliff>
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_en_US.xml
index 63f6544a..d83b434 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/template/StringResource_en_US.xml
@@ -358,6 +358,63 @@ until your certificate is renewed.</source>
<context context-type="paramnotes">{0} - Hostname of the @@PRODUCT_NAME@@ Whose Cert has Expired: highwind.devel.redhat.com </context>
</context-group>
</trans-unit>
+ <trans-unit id="email.forgotten.password">
+ <source>
+[ This is an automated email sent to {0} at your request. ]
+
+Your @@PRODUCT_NAME@@ password has been reset. To sign in, go to:
+
+https://{1}/
+
+And use the following username and password:
+
+Username: {2}
+Password: {3}
+
+Once you have logged in, you may then change your password.
+
+If you continue to have difficulties logging in, please contact
+your @@PRODUCT_NAME@@ administrator for further assistance.
+
+Thank you for using @@PRODUCT_NAME@@.
+ </source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">ForgotCredentials</context>
+ <context context-type="paramnotes">
+ {0} - Email address
+ {1} - Hostname of the @@PRODUCT_NAME@@</context>
+ {2} - Username
+ {3} - Password
+ </context-group>
+ </trans-unit>
+ <trans-unit id="email.forgotten.logins">
+ <source>
+[ This is an automated email sent to {0} at your request. ]
+
+You have requested a list of all @@PRODUCT_NAME@@ logins associated
+with the email address {0}.
+
+Existing login(s):
+
+{1}
+You may reset the passwords for any of the above @@PRODUCT_NAME@@ logins at:
+
+ https://{2}/rhn/help/ForgotCredentials.do
+
+If you continue to have difficulties logging in, please contact
+your @@PRODUCT_NAME@@ administrator for further assistance.
+If you did not request this email be sent, please disregard this message.
+
+Thank you for using @@PRODUCT_NAME@@.
+ </source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">ForgotCredentials</context>
+ <context context-type="paramnotes">
+ {0} - Email address
+ {1} - Existing logins
+ {2} - Hostname of the @@PRODUCT_NAME@@</context>
+ </context-group>
+ </trans-unit>
</body>
</file>
</xliff>
commit 0eb59408b3dec55abb480d3c251ed2acdb09decc
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Mon Oct 21 20:29:54 2013 +0200
1015747 - page handling
diff --git a/java/code/src/com/redhat/rhn/domain/user/UserFactory.java b/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
index 023b002..a881de6 100644
--- a/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
@@ -687,6 +687,19 @@ public class UserFactory extends HibernateFactory {
}
/**
+ * Return a list of all Users who has the given email.
+ *
+ * @param email String to find users for.
+ * @return list of users.
+ */
+ public static List<User> lookupByEmail(String email) {
+ Session session = HibernateFactory.getSession();
+ Query query = session.getNamedQuery("User.findByEmail")
+ .setParameter("userEmail", email);
+ return query.list();
+ }
+
+ /**
* Return a list of all User's who are in the given org.
*
* @param inOrg Org to find users for.
diff --git a/java/code/src/com/redhat/rhn/domain/user/legacy/UserImpl.hbm.xml b/java/code/src/com/redhat/rhn/domain/user/legacy/UserImpl.hbm.xml
index 5419cd1..887fc44 100644
--- a/java/code/src/com/redhat/rhn/domain/user/legacy/UserImpl.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/user/legacy/UserImpl.hbm.xml
@@ -91,6 +91,10 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<![CDATA[from com.redhat.rhn.domain.user.legacy.UserImpl as u where u.id in (:userIds)]]>
</query>
+ <query name="User.findByEmail">
+ <![CDATA[from com.redhat.rhn.domain.user.legacy.UserImpl as u where upper(u.personalInfo.email) = upper(:userEmail)]]>
+ </query>
+
<query name="User.findAllUsersByOrg">
<![CDATA[from com.redhat.rhn.domain.user.legacy.UserImpl as u where org_id = :org_id]]>
</query>
diff --git a/java/code/src/com/redhat/rhn/frontend/action/help/ForgotCredentialsAction.java b/java/code/src/com/redhat/rhn/frontend/action/help/ForgotCredentialsAction.java
new file mode 100644
index 0000000..31f44ed
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/help/ForgotCredentialsAction.java
@@ -0,0 +1,258 @@
+/**
+ * Copyright (c) 2009--2012 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.help;
+
+import com.redhat.rhn.common.conf.Config;
+import com.redhat.rhn.common.conf.ConfigDefaults;
+import com.redhat.rhn.common.hibernate.LookupException;
+import com.redhat.rhn.common.localization.LocalizationService;
+import com.redhat.rhn.common.messaging.Mail;
+import com.redhat.rhn.common.messaging.SmtpMail;
+import com.redhat.rhn.common.util.StringUtil;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.domain.user.UserFactory;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.struts.RhnHelper;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.action.DynaActionForm;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+
+/**
+ * ForgotCredentialsAction
+ * @version $Rev$
+ */
+public class ForgotCredentialsAction extends RhnAction {
+ private static Logger log = Logger.getLogger(ForgotCredentialsAction.class);
+
+ private static final long PASSWORD_REQUEST_TIMEOUT = 60;
+ private static final long LOGINS_REQUEST_TIMEOUT = 300;
+
+ /** {@inheritDoc} */
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm formIn,
+ HttpServletRequest request, HttpServletResponse response) {
+
+ DynaActionForm form = (DynaActionForm)formIn;
+
+ if (!isSubmitted(form)) {
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward(RhnHelper.DEFAULT_FORWARD),
+ request.getParameterMap());
+ }
+
+ ActionMessages msgs = new ActionMessages();
+ ActionErrors errors = new ActionErrors();
+
+ RequestContext ctx = new RequestContext(request);
+ Map forwardParams = makeParamMap(request);
+ // For saving previous request times
+ HttpSession session = request.getSession();
+
+ String email = form.getString("email");
+ String login = form.getString("username");
+
+ if (ctx.hasParam("password_button")) {
+ newPassword(login, email, errors, msgs, session);
+ }
+ else if (ctx.hasParam("login_button")) {
+ lookupLogins(email, errors, msgs, session);
+ }
+
+ if (!errors.isEmpty()) {
+ addErrors(request, errors);
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward(RhnHelper.DEFAULT_FORWARD),
+ forwardParams);
+ }
+
+ saveMessages(request, msgs);
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("success"),
+ forwardParams);
+ }
+
+ private void newPassword(String login, String email,
+ ActionErrors errors, ActionMessages msgs, HttpSession session) {
+
+ // Check if time elapsed from last request
+ if (!hasTimeElapsed(session, "password", login, PASSWORD_REQUEST_TIMEOUT)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("help.credentials.rerequest",
+ PASSWORD_REQUEST_TIMEOUT));
+ return;
+ }
+
+ try {
+ User foundUser = UserFactory.lookupByLogin(login);
+ // Check if email and login agrees
+ if (foundUser.getEmail().toUpperCase().equals(
+ email.toUpperCase())) {
+ String newPw = StringUtil.makeRandomPassword(12);
+ foundUser.setPassword(newPw);
+ UserFactory.save(foundUser);
+
+ String emailBody = setupEmailBody("email.forgotten.password",
+ email, ConfigDefaults.get().getHostname(), login, newPw);
+ sendEmail(email, LocalizationService.getInstance().
+ getMessage("help.credentials.jsp.passwordreset"), emailBody);
+
+ // Save time and login to session
+ saveRequestTime(session, "password", login);
+
+ msgs.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("help.credentials.passwordsent", email));
+ }
+ else {
+ errors.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("help.credentials.invalidemail"));
+ }
+ }
+ catch (LookupException e) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("help.credentials.invalidlogin"));
+ }
+ }
+
+ private void lookupLogins(String email,
+ ActionErrors errors, ActionMessages msgs, HttpSession session) {
+
+ // Check if time elapsed from last request
+ if (!hasTimeElapsed(session, "logins", email, LOGINS_REQUEST_TIMEOUT)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("help.credentials.rerequest",
+ LOGINS_REQUEST_TIMEOUT));
+ return;
+ }
+
+ List<User> users = UserFactory.lookupByEmail(email);
+
+ if (!users.isEmpty()) {
+ StringBuilder logins = new StringBuilder();
+
+ for (User usr : users) {
+ logins.append(usr.getLogin() + "\n");
+ }
+
+ String emailBody = setupEmailBody("email.forgotten.logins",
+ email, logins.toString(), ConfigDefaults.get().getHostname());
+ sendEmail(email, LocalizationService.getInstance().
+ getMessage("help.credentials.jsp.logininfo"), emailBody);
+
+ // Save time and email to session
+ saveRequestTime(session, "logins", email);
+
+ msgs.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("help.credentials.loginssent", email));
+ }
+ else {
+ errors.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("help.credentials.nologins"));
+ }
+ }
+
+ private void sendEmail(String recipient,
+ String subject, String body) {
+
+ Mail mail = new SmtpMail();
+ mail.setHeader("X-RHN-Info",
+ "Requested " + subject + " for " + recipient);
+ mail.setRecipient(recipient);
+ mail.setSubject(Config.get().getString("web.product_name") +
+ " " + subject);
+ mail.setBody(body);
+ log.debug("Sending mail message:\n" + mail.toString());
+ try {
+ mail.send();
+ }
+ catch (Exception e) {
+ log.error("Exception while sending email: ");
+ log.error(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Get template, enter args there and return result.
+ * @param template name of template
+ * @param args args to be in template
+ * @return complete body, args in template
+ */
+ private String setupEmailBody(String template, Object... args) {
+ // Build email body from template
+ LocalizationService ls = LocalizationService.getInstance();
+ String body = ls.getMessage(template, args);
+ return body;
+ }
+
+ /**
+ * Method for simple checking if time from last request has elapsed.
+ * Like it was in old perl page.
+ * @param session http session
+ * @param type string to name record in session
+ * @param user identification of last request author
+ * @param timeout time in seconds
+ * @return if time has elapsed
+ */
+ private boolean hasTimeElapsed(HttpSession session, String type,
+ String user, long timeout) {
+
+ // Save time and request author/login
+ Long prevRequest = (Long) session.getAttribute(
+ "previous_" + type + "_request");
+ String prevRequestUser = (String) session.getAttribute(
+ "previous_" + type + "_request_user");
+ Long now = new Date().getTime();
+
+ // Time has not elapsed for last user
+ if (prevRequest != null &&
+ ((now - prevRequest) < timeout * 1000) &&
+ (user.toUpperCase().equals(prevRequestUser))) {
+ log.debug("Unsuccesful try to request email for " + user);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Actualize record of time and user in session.
+ * @param session http session
+ * @param type string to name record in session
+ * @param user identification of last request author
+ */
+ private void saveRequestTime(HttpSession session, String type,
+ String user) {
+
+ session.setAttribute("previous_" + type + "_request",
+ new Date().getTime());
+ session.setAttribute("previous_" + type + "_request_user",
+ user.toUpperCase());
+ }
+}
commit 2f1ff50d49467bea4a8a27688100d6341156a675
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Thu Oct 17 09:13:59 2013 +0200
1015747 - new jsp page + nav stuff
diff --git a/java/code/webapp/WEB-INF/nav/sitenav.xml b/java/code/webapp/WEB-INF/nav/sitenav.xml
index 88a2aa3..4504a21 100644
--- a/java/code/webapp/WEB-INF/nav/sitenav.xml
+++ b/java/code/webapp/WEB-INF/nav/sitenav.xml
@@ -8,7 +8,7 @@
<rhn-tab name="About Spacewalk" url="/help/about.pxt" active-image="tab-about_rhn-selected.gif" inactive-image="tab-about_rhn.gif" >
<rhn-tab name="About Spacewalk" url="/help/about.pxt" />
<rhn-tab name="Help Desk" url="/rhn/help/index.do" />
- <rhn-tab name="Lookup Login/Password" url="/help/forgot_password.pxt" />
+ <rhn-tab name="Lookup Login/Password" url="/rhn/help/ForgotCredentials.do" />
<rhn-tab name="Release Notes" url="/rhn/help/dispatcher/release_notes">
<rhn-tab-directory>/rhn/help/release-notes/satellite</rhn-tab-directory>
</rhn-tab>
diff --git a/java/code/webapp/WEB-INF/pages/help/forgotcredentials.jsp b/java/code/webapp/WEB-INF/pages/help/forgotcredentials.jsp
new file mode 100644
index 0000000..c33d8dd
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/help/forgotcredentials.jsp
@@ -0,0 +1,70 @@
+<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib uri="http://rhn.redhat.com/tags/list" prefix="rl" %>
+<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
+
+<html:xhtml/>
+<html>
+<head>
+<script type="text/javascript" src="/javascript/highlander.js"></script>
+</head>
+<body>
+ <rhn:toolbar base="h1" img="/img/rhn-icon-search.gif" imgAlt="lookup"
+ helpUrl="">
+ <bean:message key="help.credentials.jsp.logininfo"/>
+ </rhn:toolbar>
+
+ <h2><bean:message key="help.credentials.jsp.passwordreset"/></h2>
+
+ <p><bean:message key="help.credentials.jsp.passwordtip"/></p>
+
+ <html:form action="/help/ForgotCredentials.do">
+ <rhn:csrf />
+ <table class="details">
+ <tr><th><bean:message key="help.credentials.jsp.logininput"/></th>
+ <td>
+ <html:text property="username" name="username" value="${username}" />
+ </td>
+ </tr>
+ <tr><th><bean:message key="help.credentials.jsp.emailinput"/></th>
+ <td>
+ <html:text property="email" name="email" value="${email}" />
+ </td>
+ </tr>
+ </table>
+ <div align="right">
+ <hr />
+ <html:submit property="password_button">
+ <bean:message key="help.credentials.jsp.passwordbutton"/>
+ </html:submit>
+ </div>
+
+ <input type="hidden" name="submitted" value="true" />
+ </html:form>
+
+ <h2><bean:message key="help.credentials.jsp.logininfo"/></h2>
+
+ <p><bean:message key="help.credentials.jsp.loginstip"/></p>
+
+ <html:form action="/help/ForgotCredentials.do">
+ <rhn:csrf />
+ <table class="details">
+ <tr><th><bean:message key="help.credentials.jsp.emailinput"/></th>
+ <td>
+ <html:text property="email" name="email" value="${email}" />
+ </td>
+ </tr>
+ </table>
+ <div align="right">
+ <hr />
+ <html:submit property="login_button">
+ <bean:message key="help.credentials.jsp.loginbutton"/>
+ </html:submit>
+ </div>
+
+ <input type="hidden" name="submitted" value="true" />
+ </html:form>
+
+</body>
+</html>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml
index f8a68b3..babc41a 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -1302,6 +1302,13 @@
<form-property name="date_am_pm" type="java.lang.Integer"/>
</form-bean>
+ <form-bean name="forgotCredentialsForm"
+ type="com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm">
+ <form-property name="username" type="java.lang.String" />
+ <form-property name="email" type="java.lang.String" />
+ <form-property name="submitted" type="java.lang.Boolean" />
+ </form-bean>
+
</form-beans>
<global-exceptions>
@@ -8088,6 +8095,18 @@
path="/WEB-INF/pages/common/errors/badcsvaction.jsp"/>
</action>
+ <action path="/help/ForgotCredentials"
+ scope="request"
+ name="forgotCredentialsForm"
+ input="/WEB-INF/pages/help/forgotcredentials.jsp"
+ type="com.redhat.rhn.frontend.action.help.ForgotCredentialsAction"
+ className="com.redhat.rhn.frontend.struts.RhnActionMapping">
+ <forward name="default"
+ path="/WEB-INF/pages/help/forgotcredentials.jsp"/>
+ <forward name="success"
+ path="/help/ForgotCredentials.do" redirect="true"/>
+ </action>
+
<action path="/help/Search"
scope="request"
name="docsSearchForm"
diff --git a/web/include/nav/sitenav.xml b/web/include/nav/sitenav.xml
index 9775219..8f8cf41 100644
--- a/web/include/nav/sitenav.xml
+++ b/web/include/nav/sitenav.xml
@@ -8,7 +8,7 @@
<rhn-tab name="About" url="/help/about.pxt" active-image="tab-about_rhn-selected.gif" inactive-image="tab-about_rhn.gif" >
<rhn-tab name="About" url="/help/about.pxt" />
<rhn-tab name="Help Desk" url="/rhn/help/index.do" />
- <rhn-tab name="Lookup Login/Password" url="/help/forgot_password.pxt" />
+ <rhn-tab name="Lookup Login/Password" url="/rhn/help/ForgotCredentials.do" />
<rhn-tab name="Release Notes" url="/rhn/help/dispatcher/release_notes">
<rhn-tab-directory>/rhn/help/release-notes/satellite</rhn-tab-directory>
</rhn-tab>
8 years, 8 months
Changes to 'refs/tags/spacewalk-java-2.1.60-1'
by Michael Mraka
Tag 'spacewalk-java-2.1.60-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2013-10-23 15:05 +0000
Tagging package [spacewalk-java] version [2.1.60-1] in directory [java/].
Changes since spacewalk-web-2.1.27-1:
Michael Mraka (3):
reformated xliff file using xmllint
added messages for SystemRemoteCommandAction.java
Automatic commit of package [spacewalk-java] release [2.1.60-1].
---
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 311 +++++-----
java/spacewalk-java.spec | 8
rel-eng/packages/spacewalk-java | 2
3 files changed, 166 insertions(+), 155 deletions(-)
---
8 years, 8 months